var t = getApp();

Page({
    data: {
        language: "",
        nickname: "",
        thumb: "",
        level_name: "",
        priceArr: [],
        isOpen: !1,
        currentIndex: 0,
        option_id: 0,
        goods_id: 0,
        date: "",
        levelId: "",
        goodsId: ""
    },
    onLoad: function(t) {
        t.goods_id && this.setData({
            goodsId: t.goods_id
        }), t.level_id && this.setData({
            levelId: t.level_id
        }), this.initData(), this.getData();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    initData: function() {
        this.setData({
            nickname: "",
            thumb: "",
            level_name: "",
            priceArr: [],
            isOpen: !1,
            currentIndex: 0,
            option_id: 0,
            goods_id: 0
        });
    },
    getData: function() {
        var e = this, a = t.getNetAddresss("plugin.universal-card.api.home.get-goods");
        a += "&goods_id=" + this.data.goodsId, a += "&level_id=" + this.data.levelId, t._getNetWork({
            url: a,
            success: function(a) {
                var n = a.data;
                1 == n.result && e.setData({
                    isOpen: !t._isTextEmpty(n.data.expire_date),
                    nickname: n.data.nickname,
                    thumb: n.data.thumb,
                    level_name: n.data.level_name,
                    priceArr: n.data.level_date,
                    goods_id: n.data.goods_id,
                    option_id: n.data.level_date[0].option_id,
                    date: n.data.expire_date
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    toggle: function(t) {
        var e = t.currentTarget.dataset.index, a = t.currentTarget.dataset.item;
        this.setData({
            currentIndex: e,
            option_id: a.option_id
        });
    },
    open: function() {
        wx.navigateTo({
            url: "/packageD/buy/myOrder_v2/myOrder_v2?tag=-2&goodsId=" + this.data.goods_id + "&optionsId=" + this.data.option_id + "&total=1"
        });
    }
});